import { defineConfig } from "vitepress";
import timeline from "vitepress-markdown-timeline";
import nav from "../导航菜单.json";
import sidebar1 from "../目录导航.json";
import sidebar2 from "../目录导航2.json";
import mdItCustomAttrs from "markdown-it-custom-attrs";
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";

const sidebar = Object.assign(sidebar1, sidebar2);
// https://vitepress.dev/reference/site-config
export default defineConfig({
  ignoreDeadLinks: true,
  // outDir: "../dist",
  // head: [["link", { rel: "icon", href: "/logo.svg" }]], // 浏览器图标
  head: [
    ["link", { rel: "icon", href: "/logo.svg" }],
    [
      "link",
      {
        rel: "stylesheet",
        href: "https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css",
      },
    ],
    [
      "script",
      {
        src: "https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js",
      },
    ],
  ],
  // head: [["meta", { name: "keywords", content: "HTML, CSS, JavaScript" }]],
  lang: "zh-CN",
  title: "汽车金融在线文档",
  description: "VitePress 开发者门户文档",
  lastUpdated: true, // 开启最近更新时间
  markdown: {
    config: (md) => {
      md.use(timeline);
      md.use(tabsMarkdownPlugin);
      md.use(mdItCustomAttrs, "image", {
        "data-fancybox": "gallery",
      });
    },
  },

  // 主题内容设置
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    logo: "/logo.svg",
    // 搜索功能
    search: { provider: "local" },

    nav: nav, // 头部导航栏

    sidebar: sidebar, // 侧边导航栏

    socialLinks: [
      {
        icon: {
          svg: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 25 24" height="24" width="25" class="tanuki-logo" role="img" aria-hidden="true">
  <path fill="#E24329" d="m24.507 9.5-.034-.09L21.082.562a.896.896 0 0 0-1.694.091l-2.29 7.01H7.825L5.535.653a.898.898 0 0 0-1.694-.09L.451 9.411.416 9.5a6.297 6.297 0 0 0 2.09 7.278l.012.01.03.022 5.16 3.867 2.56 1.935 1.554 1.176a1.051 1.051 0 0 0 1.268 0l1.555-1.176 2.56-1.935 5.197-3.89.014-.01A6.297 6.297 0 0 0 24.507 9.5Z" class="tanuki-shape tanuki"/>
  <path fill="#FC6D26" d="m24.507 9.5-.034-.09a11.44 11.44 0 0 0-4.56 2.051l-7.447 5.632 4.742 3.584 5.197-3.89.014-.01A6.297 6.297 0 0 0 24.507 9.5Z" class="tanuki-shape right-cheek"/>
  <path fill="#FCA326" d="m7.707 20.677 2.56 1.935 1.555 1.176a1.051 1.051 0 0 0 1.268 0l1.555-1.176 2.56-1.935-4.743-3.584-4.755 3.584Z" class="tanuki-shape chin"/>
  <path fill="#FC6D26" d="M5.01 11.461a11.43 11.43 0 0 0-4.56-2.05L.416 9.5a6.297 6.297 0 0 0 2.09 7.278l.012.01.03.022 5.16 3.867 4.745-3.584-7.444-5.632Z" class="tanuki-shape left-cheek"/>
</svg>`,
        },
        link: "http://10.18.134.21:32080/afc-self/afc-family/developer-portal",
      },
    ],

    // 文档内的页脚名称自定义
    docFooter: { prev: "上一篇", next: "下一篇" },

    // 最近更新时间
    lastUpdatedText: "最近更新时间",
    // editLink: {
    //   pattern:
    //     "http://10.18.134.21:32080/afc-self/afc-family/developer-portal/:path",
    //   text: "在GitLab上编辑此页面",
    // },

    outline: {
      label: "页面导航",
      level: "deep",
    },
    darkModeSwitchTitle: "切换到深色模式",
    lightModeSwitchTitle: "切换到浅色模式",

    // 页脚
    footer: {
      // message: "Released under the MIT License.",
      copyright: "东风汽车金融 @ www.dpcafc.com",
    },
  },
});
